<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //要求:输入一个年份,判断是否是闰年(闰年:能被4整除并且不能被100整除,或者被400整除)
        function isRunYear(year) {
            //如果是闰年返回 true 否则返回 false
            var flag = false;
            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                flag = true;
            }
            return flag;
        }
        console.log(isRunYear(2000));
        console.log(isRunYear(1999));



        //法2(self)
        function isRunYear(year) {
            if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                return true;
            } else {
                return false;
            }
        }
        var re = isRunYear(prompt('请您输入一个年份:'));
        if (re == true) {
            alert('您输入的是闰年');
        } else if (re == false) {
            alert('您输入的是平年');
        }
    </script>
</head>

<body>

</body>

</html>